Skip to content

Conversation

Galoretka
Copy link
Contributor

@Galoretka Galoretka commented Oct 10, 2025

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

When pruning with DeleteHistoricalDataBeforeSlot, we deleted blocks but did not remove each child root from its parent’s entry in blockParentRootIndicesBucket (schema: parentRoot -> packed children). The code only deleted the key equal to the child’s own root (i.e., “this block as parent”), leaving stale child references under the actual parent’s key.

This is a problem because ParentRoot-based queries can return pruned (non-existent) child roots, causing downstream lookups to fail and wasting resources. It also breaks index consistency guarantees.

This change fetches the block within the same transaction, derives its ParentRoot, calls deleteMatchingParentIndex to remove the child from the parent’s packed list, and only then deletes the block and related data. This mirrors the single-block DeleteBlock behavior and keeps the parent index consistent during historical pruning.

Acknowledgements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant